package com.lh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lh.entity.table.DeadlineNodeApproval;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DeadlineNodeApprovalMapper extends BaseMapper<DeadlineNodeApproval> {
    /**
     * 基于注解的批量插入（使用MySQL的VALUES语法）
     * @param list 待插入的实体列表
     * @return 插入成功的记录数
     */
    @Insert("<script>" +
            "INSERT INTO deadline_node_approval (" +
            "main_id, rectification_id, deadline, name, content, description, sort, " +
            "state, type_name, create_time, progress, remark, update_time, end_time, " +
            "is_end,department_name, real_department, deadline_type, duration, warn_level" +
            ") VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.mainId}, #{item.rectificationId}, #{item.deadline}, #{item.name}, " +
            "#{item.content}, #{item.description}, #{item.sort}, #{item.state}, " +
            "#{item.typeName}, #{item.createTime}, #{item.progress}, #{item.remark}, " +
            "#{item.updateTime}, #{item.endTime}, #{item.isEnd},#{item.departmentName}, #{item.realDepartment}, " +
            "#{item.deadlineType}, #{item.duration}, #{item.warnLevel})" +
            "</foreach>" +
            "</script>")
    int batchInsertByAnnotation(@Param("list") List<DeadlineNodeApproval> list);
}
